package net.myjung.maven;

import java.util.ArrayList;
import java.util.List;

import net.myjung.model.BaseObject;
import net.myjung.model.annotation.MdlClass;
import net.myjung.model.annotation.MdlElement;
import net.myjung.model.annotation.MdlField;

@MdlClass(name = "Build")
@SuppressWarnings("serial")
public class MvnBuild extends BaseObject {
	@MdlField(type = "net.myjung.maven.MvnProject")
	private MvnProject _parent;
	@MdlElement(type = "string")
	private String sourceDirectory;
	@MdlElement(singular = "plugin", type = "net.myjung.maven.Plugin")
	private List<MvnPlugin> plugins;
	@MdlElement(singular = "resource", type = "net.myjung.maven.Resource")
	private List<MvnResource> resources;

	public MvnProject get_parent() {
		return _parent;
	}
	public void set_parent(MvnProject _parent) {
		this._parent = _parent;
	}
	public String getSourceDirectory() {
		return sourceDirectory;
	}
	public void setSourceDirectory(String sourceDirectory) {
		this.sourceDirectory = sourceDirectory;
	}
	public List<MvnPlugin> getPlugins() {
		return plugins;
	}
	public void setPlugins(List<MvnPlugin> plugins) {
		this.plugins = plugins;
	}
	public void addPlugin(MvnPlugin plugin) {
		if (this.plugins == null)
			this.plugins = new ArrayList<MvnPlugin>();
		this.plugins.add(plugin);
	}
	public void removePlugin(MvnPlugin plugin) {
		if (this.plugins == null || !this.plugins.contains(plugin))
			return;
		this.plugins.remove(plugin);
	}
	public List<MvnResource> getResources() {
		return resources;
	}
	public void setResources(List<MvnResource> resources) {
		this.resources = resources;
	}
	public void addResource(MvnResource resource) {
		if (this.resources == null)
			this.resources = new ArrayList<MvnResource>();
		this.resources.add(resource);
	}
	public void removeResource(MvnResource resource) {
		if (this.resources == null || !this.resources.contains(resource))
			return;
		this.resources.remove(resource);
	}
}